﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Comments.aspx.cs" Inherits="BookNet.Admin.Comments" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:booknetConnectionString1 %>" 
            DeleteCommand="DELETE FROM [app_Comments] WHERE [ID] = @ID" 
            InsertCommand="INSERT INTO [app_Comments] ([ID], [ObjectID], [Rating], [Comment], [TimeAdded]) VALUES (@ID, @ObjectID, @Rating, @Comment, @TimeAdded)" 
            SelectCommand="SELECT * FROM [app_Comments]" 
            UpdateCommand="UPDATE [app_Comments] SET [ObjectID] = @ObjectID, [Rating] = @Rating, [Comment] = @Comment, [TimeAdded] = @TimeAdded WHERE [ID] = @ID">
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="Object" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="ObjectID" Type="Object" />
                <asp:Parameter Name="Rating" Type="Int32" />
                <asp:Parameter Name="Comment" Type="String" />
                <asp:Parameter Name="TimeAdded" Type="DateTime" />
                <asp:Parameter Name="ID" Type="Object" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="ID" Type="Object" />
                <asp:Parameter Name="ObjectID" Type="Object" />
                <asp:Parameter Name="Rating" Type="Int32" />
                <asp:Parameter Name="Comment" Type="String" />
                <asp:Parameter Name="TimeAdded" Type="DateTime" />
            </InsertParameters>
        </asp:SqlDataSource>
    </div>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID" 
        DataSourceID="SqlDataSource1" PageSize="20">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
            <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" 
                SortExpression="ID" />
            <asp:BoundField DataField="ObjectID" HeaderText="ObjectID" 
                SortExpression="ObjectID" />
            <asp:BoundField DataField="Rating" HeaderText="Rating" 
                SortExpression="Rating" />
            <asp:BoundField DataField="Comment" HeaderText="Comment" 
                SortExpression="Comment" />
            <asp:BoundField DataField="TimeAdded" HeaderText="TimeAdded" 
                SortExpression="TimeAdded" />
        </Columns>
    </asp:GridView>
    </form>
</body>
</html>
